<template>
    <div>
        <div class="box1" @click="loginOutFn" style="cursor:pointer;">退出</div>
        <div class="box1" @click="jiebang">解绑</div>
    </div>
</template>

<script>
import { mapActions } from 'vuex';
import { UnbindingWeChat } from "@/request/api"
export default {
    data() {
        return {

        };
    },

    mounted() {

    },

    methods: {
        ...mapActions({
            asyncChangisToastShow: "isToastShow/asyncChangisToastShow"
        }),
        // 退出登录
        loginOutFn() {
            localStorage.removeItem("x-auth-token");
            this.asyncChangisToastShow({
                isshow: true,
                msg: "您已经退出登录,即将返回首页",
                type: "success"
            })
            setTimeout(() => {
                this.$router.push('/home');
            }, 1000)
        },
        // 解绑
        async jiebang() {
            let res = await UnbindingWeChat()
            this.asyncChangisToastShow({
                isshow: true,
                msg: res.data.data,
                type: "success"
            })

        }
    },
};
</script>

<style lang="less" scoped>
.box1 {
    width: 100px;
    height: 40px;
    background-color: #0a328e;
    border-radius: 5%;
    line-height: 40px;
    color: #FFF;
    text-align: center;
    margin-bottom: 10px;
    cursor: pointer;

}
</style>